const template = require('art-template');
const dayjs = require('dayjs');
const relativeTime = require('dayjs/plugin/relativeTime');
const isSameOrBefore = require('dayjs/plugin/isSameOrBefore');

const ART_TEMPLATE_CONF = require('./conf/art-template');
const bree = require('./lib/bree');

module.exports = async function () {
  // init art-template conf
  Object.assign(template.defaults, ART_TEMPLATE_CONF);

  // init sequelize association
  require('./db/sequelize/association');

  // init dayjs
  dayjs.extend(relativeTime);
  dayjs.extend(isSameOrBefore);

  await bree.start();

  console.log('initial conf loaded');
};
